package com.inspire.ijc.agent.storage.entity;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * @author ：inspire
 * @date ：Created in 2023/4/13 16:54
 * @description：
 * @modified By：inspire
 * @version:
 */
public class CallThread {
    private long threadId;
    private String threadName;
    private int currentOrder;
    private int currentDepth;
    private long nearPushTime;
    private Date startTime;
    private Map<Integer,Integer> methodTimesMap=new HashMap<Integer, Integer>();

    public CallThread(long threadId, String threadName) {
        this.threadId = threadId;
        this.threadName = threadName;
    }

    public CallThread(long threadId, String threadName, int currentOrder, int currentDepth,Date startTime) {
        this.threadId = threadId;
        this.threadName = threadName;
        this.currentOrder = currentOrder;
        this.currentDepth = currentDepth;
        this.startTime=startTime;
    }

    public long getThreadId() {
        return threadId;
    }

    public void setThreadId(long threadId) {
        this.threadId = threadId;
    }

    public String getThreadName() {
        return threadName;
    }

    public void setThreadName(String threadName) {
        this.threadName = threadName;
    }

    public int getCurrentOrder() {
        return currentOrder;
    }

    public void setCurrentOrder(int currentOrder) {
        this.currentOrder = currentOrder;
    }

    public int getCurrentDepth() {
        return currentDepth;
    }

    public void setCurrentDepth(int currentDepth) {
        this.currentDepth = currentDepth;
    }

    public long getNearPushTime() {
        return nearPushTime;
    }

    public void setNearPushTime(long nearPushTime) {
        this.nearPushTime = nearPushTime;
    }

    public Map<Integer, Integer> getMethodTimesMap() {
        return methodTimesMap;
    }

    public void setMethodTimesMap(Map<Integer, Integer> methodTimesMap) {
        this.methodTimesMap = methodTimesMap;
    }

    public void setMethodIdTimes(int methodId){
        if(methodTimesMap.containsKey(methodId)){
            methodTimesMap.put(methodId,methodTimesMap.get(methodId)+1);
        }else{
            methodTimesMap.put(methodId,1);
        }
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }
}
